<?php
include('../conn.php');
$query="SELECT DISTINCT(id), cliente,fecha FROM pedidos WHERE alta='0'";
$resul=mysql_query($query);
$r=0;

?>

<h4>Marque los pedidos a ajustar</h4>
	<form name="forma" id="forma" action="javascript:irforma('forma','prefacturas/pre_ordenes.php','principal');" method="POST">
  <table cellpadding="0" cellspacing="0" border="0" class="display" id="example" widht="50%">
	<thead>
		<tr>
			<th>Seleccione</th>
			<th>Pedido</th>
			<th>Desglose</th>
			<th>Cliente</th>
			<th>Fecha de captura</th>
			
	
		</tr>
	</thead>
	<tbody>
		<?php
		 while ($rows=mysql_fetch_array($resul)) 
		 {
		 	$r++;
		 	$query2="SELECT nombre FROM cliente WHERE id='".$rows['cliente']."'";
		 	$resultado2=mysql_query($query2);
		 	$row2=mysql_fetch_array($resultado2);
		 	?>
		 	<tr>
		 		<td><input type="checkbox" value="<?=$rows['id']?>" name="ajuste_<?=$r?>" id="ajuste_<?=$r?>"></td>
		 		<td><?=$rows['id']?></td>
		 		<td><a href="pedidos/ver_pedido.php?id=<?=$rows['id']?>" target="_blank" onClick="window.open(this.href, this.target, 'width=1000,height=600,scrollbars=yes'); return false;">Ver desglose</a></td>
		 		<td><?=$row2['nombre']?></td>
		 		<td><?=$rows['fecha']?></td>
		 	
		 		
		 	</tr>
		 	<?php
		 }

		?>
	</tbody>
  </table>
  <input type="submit" value="Ajustar">
  </form>
  <script>
      jQuery(document).ready(function() {
        jQuery('#example').dataTable({
        	 "oLanguage": {
        	 	 "sLengthMenu": 'Mostrar <select>'+
	        '<option value="10">10</option>'+
	        '<option value="20">20</option>'+
	        '<option value="30">30</option>'+
	        '<option value="40">40</option>'+
	        '<option value="50">50</option>'+
	        '<option value="50">100</option>'+
	        '<option value="-1">Todas</option>'+
	        '</select> marcas',
	         "sSearch" : "Buscar",
            "sZeroRecords": "No hay registros",
            "sInfo": "Mostrando _START_ hasta _END_ de _TOTAL_ registros",
            "sInfoEmpty": "Mostrando 0 hasta 0 de 0 registros",
            "sInfoFiltered": "(filtrado desde _MAX_ registros totales)",
            
            	"oPaginate": {
		            "sFirst":"Primero",
		            "sLast":"Ultimo",
		            "sNext":"Siguiente",
		            "sPrevious":"Anterior"
		        	}
       		 },
        "bJQueryUI": true,
        "bStateSave": true,
         "sPaginationType": "full_numbers",
         "bAutoWidth": false,
         
        });
      } );
    </script>
